package com.vf.admin.client.service.impl;

import com.vf.admin.client.dao.AppDashanDao;
import com.vf.admin.client.dao.AppDynamicDao;
import com.vf.admin.client.dao.AppUserDao;
import com.vf.admin.client.service.AppDashanService;
import com.vf.admin.client.service.AppDynamicService;
import com.vf.admin.common.splitpage.SplitPageBean;
import com.vf.admin.miaodong.entity.AppDashan;
import com.vf.admin.miaodong.entity.AppDynamic;
import com.vf.admin.miaodong.entity.AppUser;
import com.vf.admin.utils.StringEx;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class AppDashanServiceImpl implements AppDashanService {

    @Autowired
    AppDashanDao appDashanDao;


    @Override
    public void addSave(AppUser jieshou, AppUser dashan, String uuid) {
        AppDashan appDashan=new AppDashan();
        //搭讪时间
        appDashan.setCreatetime(new Date());
        //消息发送人
        appDashan.setFsuserid(dashan.getId());
        appDashan.setFsphone(dashan.getLoginname());
        appDashan.setFstxcode(dashan.getTengxuncode());
        //消息接受人
        appDashan.setUserid(jieshou.getId());
        appDashan.setPhone(jieshou.getLoginname());
        appDashan.setTxcode(jieshou.getTengxuncode());
        //唯一标识
        appDashan.setUuid(uuid);
        //回应状态  默认是未回应
        appDashan.setHuiying(2);
        appDashanDao.save(appDashan);
    }


    @Override
    public AppDashan getDashan(Integer userid,Integer xid, String uuid) {
        return appDashanDao.getDashan(userid,xid, uuid);
    }

    @Override
    public void updateHuiying(Integer xid,Integer userId) {
        appDashanDao.updateHuiying(xid,userId);
    }

}
